@favware/querystring
Querystring that is robust in its working yet remains awesome to TypeScript users
Project Status

Bundle Sizes

Social Media and Donations

NodeJS' Querystring, but then with far stronger safety net.
Key Features
- Useable in the browser through jsDelivr, unpkg and bundle.run
- Useable in NodeJS through package manager of choice
- Typesafe
- Bundled with Rollup for maximum size reduction (only 1kB minified + gzipped!), ES module support and browser support
- Generated TypeScript declarations
- Treeshakeable in Webpack
Install
Install with yarn or npm:
yarn add @favware/querystring
Usage
Stringify
Create a querystring from a JS object
const { stringify } = require('@favware/querystring');
console.log(stringify({ prop: 'value', prop2: 'value2' }));
console.log(stringify({ prop: 'value', prop2: 'value2' }, { separator: '&', equals: '=', includeQuestion: true }));
console.log(stringify({ prop: 'value', prop2: 'value2' }, { separator: '&&', equals: '=', includeQuestion: false }));
Parse
Create a JS object from a querystring
const { parse } = require('@favware/querystring');
console.log(parse('?prop=value&prop2=value2'));
console.log(parse('?prop=value&prop2=value2', { separator: '&', equals: '=' }));
console.log(parse('prop=value&&prop2=value2', { separator: '&&', equals: '=' }));